<template>
	<view >
		<uni-popup ref="popup"  type="center"  @change="popChange">
			<view class="tip-view">
				<text class="title">请修改您的拾亲号</text>
				<!-- 拾亲号 -->
				<input class="input"placeholder="请输入拾亲号,仅可修改一次" @input="onShiQinHaoInput"/>
				<view class="btn-view">
					<text class="btn-left" @click="leftClick">取消</text>
					<text class="btn-right" @click="rightClick">确定</text>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		name: "change-shiqinhao-pop",
		props: {
			isShow:false,
			dataSource:Object,
		},
		watch: {
			isShow(val) {
				if(val){
					this.$refs.popup.open();
				}
			}
		},
		data() {
			return {
				inputShiQinHao:"",
			};
		},
		methods:{
			onShiQinHaoInput: function(event) {
				this.inputShiQinHao = event.target.value
			},
		
			popChange(e) {
				if(!e.show){
					var obj = {
						inputShiQinHao: "",
						isclose: false,
						tag:'cancle'
					};
					this.$emit('returnShiQinHaoPop', obj);
				}
			},
			leftClick(){
				var obj = {
					inputShiQinHao: "",
					isclose: false,
					tag:'cancle'
				};
				this.$emit('returnShiQinHaoPop', obj);
				this.$refs.popup.close();
			},
			rightClick(){
				var obj = {
					inputShiQinHao: this.inputShiQinHao,
					isclose: false,
					tag:'sure'
				};
				if(!this.inputShiQinHao){
					uni.showToast({
						icon:"none",
						title:"请输入您的拾亲号"
					})
					return
				}
				this.$emit('returnShiQinHaoPop', obj);
				this.$refs.popup.close();
			}
		}
	}
</script>

<style>
	@import "change-shiqinhao-pop.css";
</style>
